Chatflow – ChatTrigger Actions Sub Flow
A Sub Flow refers to a secondary or nested chatflow that is invoked from within a parent chatflow. This modular design allows you to break down complex conversations into smaller, reusable components, improving maintainability, readability, and scalability.
By calling a subflow, the parent flow temporarily transfers control to the subflow, which executes its logic independently before returning control back to the parent. This enables delegation of specific tasks or dialog sequences without duplicating code.
1. Sub Flow
Use Sub Flow to modularize your conversation by invoking another Chatflow from within the current one.
-
Click Sub Flow in the ChatTrigger palette.
-
In the dialog that appears:
Field Description Select Name* Dropdown of all existing Chatflows in your project. OK / Cancel Insert the selected sub-flow or close the dialog.
Why Sub Flows?
- Reusability: Keep common dialogs (e.g. authentication, help menus) in their own flows.
- Maintainability: Update a sub-flow once and have it reflected everywhere it’s used.
- Readability: Break large, complex conversations into manageable pieces.
2. Putting It into Practice
A typical ChatTrigger configuration might look like:
ChatTrigger
├─ Phrases: [“hello”, “hi”, “hey there”]
│ └─ Action: send “Welcome! How can I assist you today?”
├─ Phrases: [“help”, “support”]
│ └─ Sub Flow: “support-menu”
└─ Sub Flow: “fallback-handler”
- Greeting: Directly respond to “hello” style inputs.
- Help Menu: Delegate to a separate
support-menu
flow when the user asks for help. - Fallback: Use a
fallback-handler
flow for any unrecognized inputs.
Tips & Tricks
- Name Triggers Clearly: Use descriptive names for both phrases (e.g.
GreetingTrigger
) and sub-flows (e.g.OrderStatusFlow
). - Mix Phrases & Sub-Flows: You can have multiple phrase triggers and sub-flow entries under one ChatTrigger.
- Leverage Instructions: Use the Instruction field in the Phrases dialog to set system-level context (tone, persona).
- Test Frequently: After adding or modifying triggers, click Test Spark to validate end-to-end behavior.
By mastering Phrases and Sub Flow under the ChatTrigger node, you’ll create flexible, modular chatflows that scale from simple greeting bots to complex multi-step conversational assistants.